classdef dotsTheQueryablesManager < dotsAllObjectManagers
    % @class dotsTheQueryablesManager
    % Singleton to manage subclasses of dotsAllQueryables
    %
    % @ingroup queryable
    
    methods (Access=private)
        % Constructor is private.
        % @details
        % dotsTheQueryablesManager is a singleton object, so its
        % constructor is not accessible.  Use
        % dotsTheQueryablesManager.theObject() to access the current
        % instance.
        function self = dotsTheQueryablesManager(varargin)
            dotsTheMachineConfiguration.applySettingsToObject(self, true);
            self.set(varargin{:});
            self.initialize;
        end
    end
    
    methods (Static)
        % Access the current instance.
        function obj = theObject(varargin)
            persistent self
            if isempty(self) || ~isvalid(self)
                constructor = str2func(mfilename);
                self = feval(constructor, varargin{:});
            else
                self.set(varargin{:});
            end
            obj = self;
        end
        
        % Restore the current instance to a fresh state.
        function reset(varargin)
            factory = str2func([mfilename, '.theObject']);
            self = feval(factory, varargin{:});
            self.initialize;
        end
        
        % Launch a graphical interface to view managed dotsQueryable
        % objects.
        function g = gui
            self = dotsTheQueryablesManager.theObject;
            g = self.managedObjects.gui;
        end
    end
    
    methods
        % Restore the manager singleton to a fresh state.
        function initialize(self)
            self.initialize@dotsAllObjectManagers;
        end
    end
end